package transports

import (
	"context"
	"encoding/json"
	"gokit_study/endpoints"
	"net/http"
)

func DecodeUserRequest(c context.Context, r *http.Request) (interface{}, error) {
	userId := r.URL.Query().Get("user_id")
	return endpoints.UserRequest{
		UserId: userId,
	}, nil
}

func EncodeUserResponse(c context.Context, w http.ResponseWriter, response interface{}) error {
	return json.NewEncoder(w).Encode(response)
}
